True if target currently holds no items, false otherwise. The way to know, BEFORE calling queue_pop/queue_peek, whether the value they would give back is a real item or just the empty-container default.
queue_empty(target) -> bool| Name | Type |
|---|---|
target | queue |
bool
true if target currently holds no items, false otherwise. The same answer as queue_length(target) == 0, spelled as its own question.
This is the way to know, BEFORE calling queue_pop/queue_peek, whether the value either would give back is a real item or just the empty-container default - useful anywhere the difference matters (a spawner that should idle once nothing is left queued, say).
/// @type {queue<int>}
/// @capacity 4
var turn_order = [];
var nothing_queued = queue_empty(turn_order); // true
queue_push(turn_order, 1);
var has_next = queue_empty(turn_order); // false



Just the deque's empty() - O(1).